# @Version        : 1.0
# @Update Time    : 2024/12/8 0:28
# @File           : alipay_schemas.py
# @IDE            : PyCharm
# @Desc           : 文件描述信息
from pydantic import BaseModel, Field, ConfigDict
from typing import Optional, List


class GoodsDetail(BaseModel):
    # 定义商品详情模型，根据实际需求调整字段
    goods_id: str = Field(..., description="商品ID")
    goods_name: str = Field(..., description="商品名称")
    price: float = Field(..., description="商品单价")
    quantity: int = Field(..., description="商品数量")


class AlipayTradeCreate(BaseModel):
    model_config = ConfigDict(from_attributes=True, extra="allow", strict=True)

    out_trade_no: str = Field(..., title="商户订单号", description="商户网站唯一订单号")
    total_amount: float = Field(
        ..., title="订单总金额", description="订单总金额，单位为元"
    )
    subject: str = Field(..., title="订单标题", description="订单标题")
    buyer_id: Optional[str] = Field(
        None, title="买家支付宝用户ID", description="买家支付宝用户ID"
    )
    product_code: Optional[str] = Field(
        None, title="销售产品码", description="销售产品码，与接口对应"
    )
    body: Optional[str] = Field(
        None, title="商品描述", description="对一笔交易的具体描述信息"
    )
    timeout_express: Optional[str] = Field(
        None, title="超时时间表达式", description="该笔订单允许的最晚付款时间"
    )
    goods_detail: Optional[List[GoodsDetail]] = Field(
        None, title="商品详情列表", description="订单包含的商品列表信息"
    )
    operator_id: Optional[str] = Field(
        None, title="收银员编号", description="收银员的编号"
    )
    store_id: Optional[str] = Field(None, title="门店编号", description="门店编号")
    terminal_id: Optional[str] = Field(None, title="终端编号", description="终端编号")
